package com.xindaoapp.happypet.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;

import com.xindaoapp.happypet.R;
import com.xindaoapp.happypet.activity.MyLoveActivity;
import com.xindaoapp.happypet.utils.CommonParameter.UserState;

public class PersonCenterActivity extends BaseActivity implements OnClickListener {

    private TextView tab_mylove;

    private ImageButton common_back_button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.person_center, menu);
        return true;
    }


    @Override
    protected void initViews() {
        // TODO Auto-generated method stub
        super.initViews();
        tab_mylove = (TextView) findViewById(R.id.tab_mylove);
        common_back_button = (ImageButton) findViewById(R.id.common_back_button);
    }


    @Override
    protected void initEvents() {
        // TODO Auto-generated method stub
        super.initEvents();
        tab_mylove.setOnClickListener(this);
        common_back_button.setOnClickListener(this);
    }


    @Override
    protected void onLoadDatas() {
        // TODO Auto-generated method stub
        super.onLoadDatas();
    }


    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        int id = v.getId();
        Intent intent = new Intent();

        switch (id) {
            case R.id.tab_mylove:
                if (UserState.isLogged()) {
                    intent.setClass(this, MyLoveActivity.class);
                    startActivity(intent);
                }
                break;
            case R.id.common_back_button:
                if (UserState.isLogged()) {
                    finish();
                }
                break;

            default:
                break;
        }
    }


    @Override
    protected int getContentViewResId() {
        return R.layout.activity_person_center;
    }


}
